export enum SSMLTagEnum {
  SPEAK = 'speak',
  BREAK = 'break',
  PHONEME = 'phoneme',
  SAY_AS = 'say-as',
}

export interface VNode<TagName = unknown> {
  attribs?: Record<string, any>
  data?: string
  type: 'text' | 'tag'
  name?: TagName
  children?: VNode[]
}

export interface VTree {
  type: 'root',
  children?: VNode[]
}

export enum SSMLProvider {
  DEFAULT = 'default',
  YUAN = 'yuan',
}

export interface SSMLSpeakElement<SpeakTagName = unknown> extends VNode {
  type: 'tag'
  name: SpeakTagName
}

export interface SSMLEmotionAttribs {
  category: string
  intensity: number
}

export interface SSMLEmotionElement extends VNode {
  attribs: Partial<SSMLEmotionAttribs>
  type: 'tag'
  name: 'emotion'
}

export interface SSMLBreakAttribs {
  time: string
}

export interface SSMLBreakElement extends VNode {
  attribs: Partial<SSMLBreakAttribs>
  type: 'tag'
  name: 'break'
}

export interface SSMLSElement extends VNode {
  attribs: {}
  type: 'tag'
  name: 's'
}

export interface SSMLSubAttribs {
  alias: string
}

export interface SSMLSubElement extends VNode {
  attribs: Partial<SSMLSubAttribs>
  type: 'tag'
  name: 'sub'
}

export interface SSMLWElement extends VNode {
  attribs: {}
  type: 'tag'
  name: 'w'
}

export interface SSMLVhmlAttribs {
  src: string
}

export interface SSMLVhmlElement extends VNode {
  attribs: Partial<SSMLVhmlAttribs>
  type: 'tag'
  name: 'vhml'
}

export interface SSMLPhonemeAttribs {
  alphabet: 'py'
  ph: string
}

export interface SSMLPhonemeElement extends VNode {
  attribs: Partial<SSMLPhonemeAttribs>
  type: 'tag'
  name: 'phoneme'
}

export interface SSMLSoundEventAttribs {
  src: string
}

export interface SSMLSoundEventElement extends VNode {
  attribs: Partial<SSMLSoundEventAttribs>
  type: 'tag'
  name: 'soundEvent'
}

export interface SSMLSayAsAttribs {
  'interpret-as': 'cardinal' | 'digits' | 'telephone' | 'name' | 'address' | 'id' | 'characters' | 'punctuation' | 'currency' | 'measure'
}

export interface SSMLSayAsElement extends VNode {
  attribs: Partial<SSMLSayAsAttribs>
  type: 'tag'
  name: 'say-as'
}

export type RenderType = 'text' | SSMLTagEnum

export type RenderDataType = 'text' | 'word' | 'number' | 'chinese' | 'break' | 'lineBreak'

export type RenderNodeId = number | string

export interface SSMLRenderNode {
  id: RenderNodeId
  type: RenderType
  attribs: Record<string, any>
  checked?: boolean
  data?: string
  dataType?: RenderDataType
  mark?: string
  label?: string
  defaultMark?: string;
  marked?: boolean
  children?: Array<SSMLRenderNode>
}

export interface SelectItem {
  origin: string;
  result: string;
  isZh: boolean;
  mark?: string;
  label?: string;
  originPinyin?: string;
  pinyin?: string;
  num?: string;
}
